define(["jquery", "easy-admin"], function ($, ea) {

var url = 'bot/log/index';
if (typeof gfid !== 'undefined' && gfid !== '-1') {
    url = 'bot/log/index?filter=%7B%22botid%22%3A%22'+gfid+'%22%7D&op=%7B%22botid%22%3A%22%25*%25%22%7D';
}

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: url,
        add_url: 'bot/log/add',
        edit_url: 'bot/log/edit',
        delete_url: 'bot/log/delete',
        export_url: 'bot/log/export',
        modify_url: 'bot/log/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh'],
                cols: [[

                    {field: 'id', title: 'ID',search: false},
                    //{field: 'botid', title: '机器人ID',search: false},
                    //{field: 'groupid', title: '群ID',search: false},
                    {field: 'uid', title: '用户',search: false},
                    {field: 'type', title: '类型',search: false,selectList: {1: '<a style="color:#1e9fff">模糊匹配</a>', 2: '<a style="color:#16b777">替换文字</a>',3:'<a style="color:#a233c6">撤回消息</a>'}},
                    {field: 'gjz', title: '关键字',search: false},
                    {field: 'cz', title: '操作',search: false,width:"20%"},
                    {field: 'ufy', title: '原始发言',search: false,width:"20%"},
                    {field: 'time', title: '时间',search: false,templet:'<div><a>{{dateFormat(d.time)}}</a></div>'},
                    //{width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});